<?php

/**
 * @package Framework03
 * @author Walter Tamboer
 */

/**
 * A cookie which can be stored in the CookieJar.
 */
class Cookie
{
	/**
	 * @var string The name of this cookie.
	 */
	private $Name;
	/**
	 * @var mixed The data of this cookie.
	 */
	private $Data;
	/**
	 * @var int The life in seconds of this cookie.
	 */
	private $Life;
	/**
	 * Initializes a new instance of this class.
	 * @param string $Name The name of this cookie.
	 * @param mixed $Data The data of this cookie.
	 * @param int $Life The time in seconds of this cookie.
	 */
	public function __construct($Name = null, $Data = null, $Life = 0)
	{
		$this->Name = null;
		$this->Data = null;
		$this->Life = 0;
	}
	/**
	 * Gets the name of this cookie.
	 * @return string Returns a string with the name of this cookie.
	 */
	public function GetName()
	{
		return $this->Name;
	}
	/**
	 * Sets the name of this cookie.
	 * @param string $Value The new value to set.
	 */
	public function SetName($Value)
	{
		$this->Name = $Value;
	}
	/**
	 * Gets the data of this cookie.
	 * @return mixed Returns a mixed value with the data of this cookie.
	 */
	public function GetData()
	{
		return $this->Data;
	}
	/**
	 * Sets the data of this cookie.
	 * @param mixed $Value The new value to set.
	 */
	public function SetData($Value)
	{
		$this->Data = $Value;
	}
	/**
	 * Gets the life of this cookie.
	 * @return int Returns an integer with the life of this cookie.
	 */
	public function GetLife()
	{
		return $this->Life;
	}
	/**
	 * Sets the life of this cookie.
	 * @param int $Value The new value to set.
	 */
	public function SetLife($Value)
	{
		$this->Life = $Value;
	}
	/**
	 * Saves the cookie to the cookie jar.
	 */
	public function Save()
	{
		CookieJar::Set($this->Name, $this->Value, $this->Life);
	}
}

?>